package com.lineage.server.serverpackets;

import com.lineage.server.datatables.lock.BoardReading;
import com.lineage.server.templates.L1Board;

public class S_BoardRead extends ServerBasePacket {
  private byte[] _byte;
  
  public S_BoardRead(int number) {
    this._byte = null;
    buildPacket(number);
  }
  
  private void buildPacket(int number) {
    L1Board board = BoardReading.get().getBoardTable(number);
    writeC(148);
    writeD(board.get_id());
    writeS(board.get_name());
    writeS(board.get_date());
    writeS(board.get_title());
    writeS(board.get_content());
  }
  
  public S_BoardRead() {
    this._byte = null;
    writeC(148);
    writeD(10);
    writeS("测试NAME");
    writeS("2010-02-02");
    writeS("测试TITLE");
    writeS("测试内容");
  }
  
  public byte[] getContent() {
    if (this._byte == null)
      this._byte = getBytes(); 
    return this._byte;
  }
  
  public String getType() {
    return getClass().getSimpleName();
  }
}
